﻿/*******************************************************************  
 * Copyright (C) vancl.com
 * All rights reserved. 
 * 
 * Created By: VANCLOA\hanxianlong
 * Create Date:2011/8/17 13:10:23
 * Last Modified By:VANCLOA\hanxianlong
 * Last Modified Date:2011/8/17 13:10:23
 * Description: 每一列的数据描述
 * ********************************************************************/
#region Using directives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregion

namespace SimpleCodeGenerator.Schema
{
	/// <summary>
	/// 类的说明
	/// </summary>
	public class ColumnSchema
	{
		/// <summary>
		/// 名称
		/// </summary>
		public string Name { get; set; }

		/// <summary>
		/// 代码
		/// </summary>
		public string Code { get; set; }

		/// <summary>
		/// 备注
		/// </summary>
		public string Comment { get; set; }
		/// <summary>
		/// 数据类型
		/// </summary>
		public string DataType { get; set; }

		/// <summary>
		/// 是否可空
		/// </summary>
		public bool IsNullable { get; set; }

		/// <summary>
		/// 是否为主键
		/// </summary>
		public bool  IsPrimaryKey { get; set; }

		/// <summary>
		/// 是否为自增类型
		/// </summary>
		public bool IsIdentity { get; set; }

		/// <summary>
		/// 当前列的类型是否为数字类型
		/// </summary>
		public bool IsNumberDataType
		{
			get
			{
				return string.Compare(DataType, "int") == 0
					|| string.Compare(DataType, "long") == 0
					|| string.Compare(DataType, "short") == 0
					|| string.Compare(DataType, "float") == 0
					;
			}
		}

		/// <summary>
		/// 当前列的类型是否为日期类型
		/// </summary>
		public bool IsDateTimeType
		{
			get
			{
				return string.Compare("DateTime", DataType) == 0;
			}
		}
	}
}
